package main

import (
	"fmt"
)

type Teacher struct {
	name string
	age int
	married bool
	sex int8
}

func main() {
	a := Teacher{"Steven",35,true,1}
	fmt.Printf("1、a的内存地址为：%p,值为：%v \n\n",&a,a)
	changeStructValue(a)
	fmt.Printf("2、changeStructValue 函数调用后：值参数a的内存地址：%p,值为：%v \n",&a,a)
	changeStructPtr(&a)
	fmt.Printf("3、changeStructPtr 函数调用后：值参数a的内存地址：%p,值为：%v \n",&a,a)
}

func changeStructValue(a Teacher)  {
	fmt.Printf("changeStructValue 函数内：值参数a的内存地址：%p,值为：%v \n",&a,a)
	a.name = "Josh"
	a.married = false
	a.age = 29
	a.sex = 0
}

func changeStructPtr(a *Teacher)  {
	fmt.Printf("changeStructPtr 函数内：指针参数a的内存地址：%p,值为：%v \n",&a,a)
	a.name = "Daniel"
	a.married = false
	a.age = 20
	a.sex = 1
}